﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="layuimini/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="layuimini/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <blockquote class="layui-elem-quote layui-text">
            数据抽取
        </blockquote>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend> 数据抽取</legend>
        </fieldset>

        <form class="layui-form" action="">
            
            <div class="layui-form-item">
                <div class="layui-inline" style="margin-right: 2px">
                    <label class="layui-form-label required" style="padding-right: 5px;padding-left: 1px">抽取类型</label>
                    <div class="layui-input-inline" >
                        <select name="mode" lay-verify="required" lay-filter="mode" >
                        <option value=""></option>
                        <option value="0">单检</option>
                        <option value="1">抽检</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline" style="margin-right: 2px">
                    <label class="layui-form-label required" style="padding-right: 5px;padding-left: 1px">抽取人数</label>
                    <div class="layui-input-inline">
                        <input type="number" name="extractKSNumber" lay-verify="required|number" autocomplete="off" class="layui-input">
                    </div>
                </div>

            </div>
            <div class="layui-form-item">
            <div class="layui-inline" style="margin-right: 2px" id="cjbl">
                <label class="layui-form-label required" style="padding-right: 5px;padding-left: 1px">抽取比例</label>
                <div class="layui-input-inline">
                    <input id="icjbl" type="number" name="rate" value="100" lay-verify="required|number" autocomplete="off" class="layui-input">
                </div>
            </div>
                <div class="layui-inline" style="margin-right: 2px" id="kddm">
                    <label class="layui-form-label required" style="padding-right: 5px;padding-left: 1px">考点代码</label>
                    <div class="layui-input-inline">
                        <input id="ikddm" type="text" name="kddm" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="extractData">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>

        </form>
    </div>
</div>

<script src="layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="layuimini/js/MyUtils.js" charset="utf-8"></script>
<script src="layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate
            ,$=layui.jquery;

        //监听下拉框
        form.on('select(mode)', function (data) {
            console.log(data.value)
            if(data.value==0){
                $("#cjbl").hide()
                $("#kddm").show()
                $("#ikddm").attr("lay-verify","required")
                $("#icjbl").attr("lay-verify","")
            }else if(data.value==1){
                $("#cjbl").show()
                $("#kddm").hide()
                $("#icjbl").attr("lay-verify","required")
                $("#ikddm").attr("lay-verify","")
            }

                  });

        //监听提交
        form.on('submit(extractData)', function (data) {
      
           postRequestLoad("/extractData",JSON.stringify(data.field))
	
          
         
            

            return false;
        });

    });


</script>

</body>
</html>